home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DLLCust_Files / BIASAXON / ADJLINA.C next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.2 KB  |  42 lines

  1. // Dynamic link library implementation of LinearAxon with adaptible slope
  2.  
  3. #include "NSDLL.h" 
  4.  
  5. /***********************************/
  6. /* Forward activation of component */
  7.  
  8. __declspec(dllexport) void performBiasAxon(
  9.     DLLData    *instance,    // Pointer to instance data
  10.     NSFloat    *data,         // Pointer to the layer of processing elements (PEs)
  11.     int     rows,        // Number of rows of PEs in the layer
  12.     int     cols,        // Number of columns of PEs in the layer
  13.     NSFloat    *bias        // Pointer to the layer's bias vector, one for each PE
  14.     )
  15. {
  16.     int i, length=rows*cols;
  17.     NSFloat *beta = getWeights(instance);
  18.  
  19.     for (i=0; i<length; i++)
  20.         data[i] = beta[i]*data[i] + bias[i];
  21. }
  22.  
  23. /******************************************/
  24. /* Management of instance data (OPTIONAL) */
  25.  
  26. __declspec(dllexport) DLLData *allocBiasAxon(
  27.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  28.     int     rows,            // Number of rows of PEs in the layer
  29.     int     cols            // Number of columns of PEs in the layer
  30.     )
  31. {
  32.     DLLData *instance = allocDLLInstance(oldInstance);
  33.     setWeights(instance, rows*cols);
  34.     return instance;
  35. }
  36.  
  37. __declspec(dllexport) void freeBiasAxon(DLLData *instance)
  38. {
  39.     freeDLLInstance(instance);
  40. }
  41.  
  42.